package com.example.navigation.base

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment

/**
 * @author Liyg
 * @description: Fragment的基类
 * @date :2020/11/13
 */
abstract class BaseFragment :Fragment(){
    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        val rootView = inflater.inflate(getLayoutResId(),container,false)
        //初始化rootView
        initView(rootView)
        return rootView
    }

    open fun initView(rootView: View) {

    }

    /**
     * 获取资源Id
     */
    abstract fun getLayoutResId():Int
}